package com.sy.messages;

import lombok.Data;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * @Author yumax
 * @Date 2024 01 16 10 00
 **/
@Data
public abstract class Message implements Serializable {

    private static final long serialVersionUID = 7744766760595616963L;

    private static Class<? extends Message> getMessageClass(int messageType) {
        return messageClasses.get(messageType);
    }

    private int sequenceId;

    private int messageType;

    public static final int LoginRequestMessage = 0;
    public static final int LoginResponseMessage = 1;

    private static final Map<Integer, Class<? extends Message>> messageClasses = new HashMap<>();

    static {
        messageClasses.put(LoginRequestMessage, LoginRequestMessage.class);

    }
}
